<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>房台</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
		<style type="text/css">
			#sfz_pic{position: relative;}/*opacity: 0;*/
			 .upload,.upload1{position: absolute;top: 0;left: 0;width: 100%;height: 100%;opacity: 0;}
		</style>
	</head>

	<body>
		<form class="layui-form update_form">
			<div class="layui-form-item">
				<label class="layui-form-label">房台名称/编号</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="id" style="display: none;" value="{$data.id}">
					<input type="text" name="name" value="{$data.name}" required lay-verify="required" placeholder="房台名称/编号" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">适用人数</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="scope_limit" value="{$data.scope_limit}" required lay-verify="required" placeholder="适用人数" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">房台分类</label>
				<div class="layui-input-block" style="float: left; margin-right: 20px; margin-left: 0;">
					<select name="type_id" lay-verify="required">
						{volist name="typelist" id="vo"}
						<option value="{$vo.id}" {if condition="$data.type_id==$vo.id" } selected="selected" {/if}>{$vo.type_name}</option>
						{/volist}
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-block">
					<input type="radio" name="status" value="2" title="开启" {if condition="$data['status'] eq 2 " }checked{/if}>
					<input type="radio" name="status" value="1" title="关闭" {if condition="$data['status'] eq 1 " }checked{/if}>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">归属门店</label>
				<div class="layui-input-block" style="float: left; margin-right: 20px; margin-left: 0;">
					<select name="chain_id" lay-verify="required">
						{volist name="storelist" id="vo"}
						<option value="{$vo.id}" {if condition="$data.chain_id==$vo.id" } selected="selected" {/if}>{$vo.store_name}</option>
						{/volist}
					</select>
				</div>
			</div>
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="submit_from"  type="button" >立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>
</html>
<script>
	layui.use('form', function() {
		var form = layui.form;
		//监听表单提交
		form.on('submit(submit_from)', function(data){
			tijiao();
  			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
	});


function tijiao() {
$.ajax({
	type: "post",
	url: "{:url('store/house_edit')}",
	data: $('.layui-form').serialize(), //表单数据
	success: function(data) {
		if(data.code == 200) {
			layer.msg('修改成功', {
				icon: 1,
				time: 1500 //2秒关闭（如果不配置，默认是3秒）
			}, function() {
				window.parent.location.reload();
				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
				parent.layer.close(index);
			});
		} else {
			layer.msg('修改失败！'); //保存成功提示
			}
		},
		error: function(data) {
			var a = data;
		}
	});

}
</script>